package com.situ.water_system.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.situ.water_system.mapper.SyDeptMapper;
import com.situ.water_system.pojo.SyArea;
import com.situ.water_system.pojo.SyDept;
import com.situ.water_system.service.SyAreaService;
import com.situ.water_system.service.SyDeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Angel
 * @since 2020-12-01
 */
@RestController
@RequestMapping("/Sydept")
public class SyDeptController {
    @Autowired
    private SyDeptService service;
    @RequestMapping("/queryall")
    public List<SyDept> queryall() {
        return service.selectList();
    }

    @RequestMapping("/queryByid/{id}")
    public SyDept queryByid(@PathVariable(name = "id") Integer id) {
        return service.selectByid(id);
    }

    @RequestMapping("/del/{id}")
    public int del(@PathVariable(name = "id") Integer id) {
        return service.del(id);
    }

    @RequestMapping("/add")
    public int insert(SyDept syArea) {
        return service.add(syArea);
    }

    @RequestMapping("/update")
    public int update(SyDept syArea) {
        return service.update(syArea);
    }
    @RequestMapping("/query_flow")
    public List<Map> query_flow(){
        return service.query_flow();
    }
    @RequestMapping("/update_flow")
    public int update_flow(String id,String deptid){
        Map flow = new HashMap();
        flow.put("id", id);
        flow.put("deptid", deptid);
        System.out.println(flow.toString());
        return service.update_flow(flow);
    }

}

